<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改团员信息')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-teamYlInfo-edit" >
            <input name="ylId" th:value="${teamYlInfo.ylId}" type="hidden">
            <input name="ylType" th:value="${teamYlInfo.ylType}" type="hidden">
            <div class="row">
            <div class="form-group">
                <label class="col-sm-3 control-label">团长编号：</label>
                <div class="col-sm-8">
                    <input name="ylId" readonly th:value="${teamYlInfo.ylId}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">团队编号：</label>
                <div class="col-sm-8">
                    <input name="teamYlId" readonly th:value="${teamYlInfo.teamYlId}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">团长展业端管理编号：</label>
                <div class="col-sm-8">
                    <input name="agentNum" readonly th:value="${teamYlInfo.agentNum}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">团长展业端管理名称：</label>
                <div class="col-sm-8">
                    <input name="agentName" readonly th:value="${teamYlInfo.agentName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">团长状态：</label>
                <div class="col-sm-8">
                    <select name="status"  th:value="${teamYlInfo.status}" class="form-control m-b">
                        <option th:selected="${teamYlInfo.status == '1'}" value="1">正常</option>
                        <option th:selected="${teamYlInfo.status == '0'}" value="0">关停</option>
                    </select>
                </div>
            </div>
                <div class="form-group" style="display: none">
                    <label class="col-sm-3 control-label">团队类型：</label>
                    <div class="col-sm-8">
                        <select name="teamType" id="teamType" th:value="${teamYlInfo.teamType}" onchange="selectOnchange(this)" class="form-control m-b">
                            <option th:selected="${teamYlInfo.teamType == 1}" value="1">老团</option>
                            <option th:selected="${teamYlInfo.teamType == 2}" value="2">新团</option>
                        </select>
                    </div>
                </div>
            </div>
            <div id="old" style="display: none">
                <h4 class="form-header h4" >老团政策信息</h4>
                <div class="row">
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">引流奖励：</label>
                            <div class="col-sm-8">
                                <select name="policyYlId"  class="form-control m-b">
                                    <option value="">所有</option>
                                    <option th:each="oy:${oldYList}" th:text="${oy.policyName}" th:value="${oy.id}" th:selected="${oy.id} eq ${teamYlInfo.policyYlId}" ></option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">采购奖励：</label>
                            <div class="col-sm-8">
                                <select name="policyCgId" class="form-control m-b">
                                    <option value="">所有</option>
                                    <option th:each="oc:${oldCList}" th:text="${oc.policyName}" th:value="${oc.id}" th:selected="${oc.id} eq ${teamYlInfo.policyCgId}"></option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">增量奖励：</label>
                            <div class="col-sm-8">
                                <select name="policyZlId" class="form-control m-b">
                                    <option value="">所有</option>
                                    <option th:each="oz:${oldZList}" th:text="${oz.policyName}" th:value="${oz.id}" th:selected="${oz.id} eq ${teamYlInfo.policyZlId}"></option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div id="new">
                <h4 class="form-header h4" >新团政策信息</h4>
                <div class="row">
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">引流奖励：</label>
                            <div class="col-sm-8">
                                <select name="policyYlId"  class="form-control m-b">
                                    <option value="-1">暂无</option>
                                    <option th:each="ny:${newYList}" th:text="${ny.policyName}" th:value="${ny.id}" th:selected="${ny.policyId} eq ${teamYlInfo.policyYlId}" ></option>
                                    <option value="">所有</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">采购奖励：</label>
                            <div class="col-sm-8">
                                <select name="policyCgId" class="form-control m-b">
                                    <option value="-1">暂无</option>
                                    <option th:each="nc:${newCList}" th:text="${nc.policyName}" th:value="${nc.id}" th:selected="${nc.policyId} eq ${teamYlInfo.policyCgId}"></option>
                                    <option value="">所有</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">增量奖励：</label>
                            <div class="col-sm-8">
                                <select name="policyZlId" class="form-control m-b">
                                    <option value="-1">暂无</option>
                                    <option th:each="nz:${newZList}" th:text="${nz.policyName}" th:value="${nz.id}" th:selected="${nz.policyId} eq ${teamYlInfo.policyZlId}"></option>
                                    <option value="">所有</option>
                                </select>
                            </div>
                        </div>
                    </div>
<!--                    <div class="col-sm-6">-->
<!--                        <div class="form-group">-->
<!--                            <label class="col-sm-3 control-label">GB传统引流奖励：</label>-->
<!--                            <div class="col-sm-8">-->
<!--                                <select name="policyGbId" class="form-control m-b">-->
<!--                                    <option value="-1">暂无</option>-->
<!--                                    <option th:each="nz:${newGBList}" th:text="${nz.policyName}" th:value="${nz.id}" th:selected="${nz.policyId} eq ${teamYlInfo.policyGbId}"></option>-->
<!--                                    <option value="">所有</option>-->
<!--                                </select>-->
<!--                            </div>-->
<!--                        </div>-->
<!--                    </div>-->
                    <input type="hidden" value="-1" name="policyGbId">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "team/teamYlInfo";
        $("#form-teamYlInfo-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-teamYlInfo-edit').serialize());
            }
        }

        if($("#teamType").val() == 1){
            $("#new").hide();
        }else{
            $("#old").hide();
        }

        /**
         * 选择类型
         */
        function selectOnchange(obj) {
            //DATE没有长度
            if (obj.value == '1'){
                $("#new").hide();
                $("#old").show();
            } else if (obj.value == '2'){
                $("#old").hide();
                $("#new").show();
            }
        }

    </script>
</body>
</html>